import request from '@/utils/request'
//基础图库列表
export function getquestion(params, subjectID, keyword) {
    return request({
        url: '/questions',
        method: 'GET',
        params,
        keyword,
        subjectID,
    })
}


//删除基础题库
export function deletequestion(id) {
    return request({
        url: '/questions/' + id,
        method: 'DELETE'
    })
}

// 加入精选
export function addchoiceness(id, choiceState) {
    return request({
        url: `/questions/choice/${id}/${choiceState}`,
        method: "PATCH",
    });
}

// 获取目录
export function getcatalogue(id) {
    return request({
        url: "/directorys",
        params: {
            subjectID: id,
        },
    });
}

// 获取学科列表
export function getsubject() {
    return request({
        url: "/subjects",
        params: {
            page: 1,
            pagesize: 200,
        },
    });
}

// 标签添加
export function gettags() {
    return request({
        url: "/tags",
        method: 'GET'
    });
}


// 获取基础题库详情
export function getquestionsDetail(id) {
    return request({
        url: '/questions/' + id,
        method: 'GET'
    })
}

// 修改基础题库
export function editquestionsDetail(id, data) {
    return request({
        url: '/questions/' + id,
        method: 'PUT',
        data: data
    })
}

// 用户列表
export function getusers() {
    return request({
        url: '/users',
        method: 'GET'
    })
}

// 精选题库列表
export function getProvinceCity(params) {
    return request({
        url: '/questions/choice',
        method: 'GET',
        params
    })
}

// 加入或移出精选
export function delquestions(id) {
    return request({
        url: '/questions/choice/:id/:choiceState',
        method: 'PATCH'
    })
}

// 组题列表删除
export function delQuesList(id) {
    return request({
        url: '/questions/randoms/:id',
        method: 'PATCH'
    })
}
// 目录列表

export function directorys() {
    return request({
        url: '/directorys',
        method: 'GET'
    })
}
// 题库详情

export function questions(id) {
    return request({
        url: `/questions/${id}`,
        method: 'GET',
        params: {
            id: id
        }
    })
}